<?php

class User_Form_Login extends Zend_Form
{
	public $elementDecorators = array(
        'ViewHelper',
        'Errors',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
        array('Label', array('tag' => 'td')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
    );
	
	public $buttonDecorators = array(
        'ViewHelper',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
        array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
    );
	
	public function loadDefaultDecorators()
    {
        $this->setDecorators(array(
            'FormElements',
            array('HtmlTag', array('tag' => 'table')),
            'Form',
        ));
    }

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
		$this->setMethod('post');
		
		$this->addElement(
            'text', 'username', array(
            'label' => 'Tài khoản:',
			'size' => 20,
            'required' => true,
            'filters' => array('StringTrim'),
			'decorators' => $this->elementDecorators,
        ));
        
        $this->addElement('password', 'password', array(
            'label' => 'Mật khẩu:',
			'size' => 20,
            'required' => true,
			'decorators' => $this->elementDecorators,
        ));
        
        $this->addElement('submit', 'submit', array(
            'ignore' => true,
            'label' => 'Đăng nhập',
			'decorators' => $this->buttonDecorators,
        ));
    }


}

